<%--
  Created by IntelliJ IDEA.
  User: zq
  Date: 2021/11/11
  Time: 9:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%--引入c标签库--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<style>

</style>
<head>
    <title>驾校查询</title>
</head>
<body>
<h1>驾校信息修改</h1>
<div>
    城区:
    <select name="city">
        <c:forEach items="${searchList}" var="slist">
            <option value="${slist.id}" id="key">${slist.name}</option>
        </c:forEach>
    </select>

    <button type="submit" name="select" onclick="search();">查询</button>
    <table border="1">
        <tr>
            <td>驾校名称</td>
            <td>所在城区</td>
            <td>地址</td>
            <td>联系电话</td>
            <td>操作</td>
        </tr>
        <tbody id="content">
            <c:forEach var="dslist" items="${driveSchoollist}">
                <tr>
                    <td>${dslist.name}</td>
                    <td>${dslist.cName}</td>
                    <td>${dslist.address}</td>
                    <td>${dslist.phone}</td>
                    <td onclick="update();">修改</td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</div>
</body>
<%--百度压缩版引用地址:--%>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
    function search() {
        var name = $("#key").text();
        alert(name);
        //编写AJax方法
        $.ajax({
            "url" : "/DriverSchoolSystem/update",
            "type" : "get",
            "data" : {
                "aid" : name
            },
            "dataType" : "text",
            "success" : function(result) {

            },
            "error" : function() {
                alert("服务器错误");
            }
        });
    }

    function update() {
        var id = $("#schoolId").val();
        alert(id);
        //编写AJax方法
        $.ajax({
            "url" : "//DriverSchoolSystem/update",
            "type" : "get",
            "data" : {
                "aid" : id
            },
            "dataType" : "text",
            "success" : function(result) {

            },
            "error" : function() {
                alert("服务器错误");
            }
        });
    }
</script>
</html>

